import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const router = new Router({
    mode: 'history',
    routes: [{
            path: '/',
            redirect: '/modifyc'
        },
        {
            path: '/',
            component: () =>
                import ( /* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件', requireAuth: true },
            children: [{
                    path: '/addc',
                    name: 'addc',
                    component: () =>
                        import ( /* webpackChunkName: "SysIndex" */ '../components/page/addC.vue'),
                    meta: { title: '添加应聘者信息', requireAuth: true }
                },
                {
                    path: '/modifyc',
                    name: 'modifyc',
                    component: () =>
                        import ( /* webpackChunkName: "friendlist" */ '../components/page/modifyC.vue'),
                    meta: { title: '应聘者信息中心', requireAuth: true }
                },
                {
                    path: '/searchc',
                    name: 'searchc',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/searchC.vue'),
                    meta: { title: '查找应聘者信息', requireAuth: true }
                },
                {
                    // BlogEdit
                    path: '/deletec',
                    name: 'deletec',
                    component: () =>
                        import ( /* webpackChunkName: "BlogEdit" */ '../components/page/deleteC.vue'),
                    meta: { title: '删除应聘者信息', requireAuth: true }
                },
                {
                    // BlogEdit
                    path: '/addgradec',
                    name: 'addgradec',
                    component: () =>
                        import ( /* webpackChunkName: "BlogEdit" */ '../components/page/addGradeC.vue'),
                    meta: { title: '录入应聘者分数', requireAuth: true }
                },
                {
                    // BlogEdit
                    path: '/JianLi',
                    name: 'JianLi',
                    component: () =>
                        import ( /* webpackChunkName: "BlogEdit" */ '../components/page/JianLi.vue'),
                    meta: { title: '应聘者简历', requireAuth: true }
                },
                {
<<<<<<< HEAD
                    path: '/blogtag',
                    name: 'blogtag',
                    component: () =>
                        import ( /* webpackChunkName: "blogtag" */ '../components/page/BlogTag.vue'),
                    meta: { title: '标签目录', requireAuth: true }
                },
                {
                    path: '/category',
                    name: 'category',
                    component: () =>
                        import ( /* webpackChunkName: "category" */ '../components/page/CateGory.vue'),
                    meta: { title: '分类目录', requireAuth: true }
                },
                {
                    path: '/comments',
                    name: 'comments',
                    component: () =>
                        import ( /* webpackChunkName: "category" */ '../components/page/Comments.vue'),
                    meta: { title: '评论管理', requireAuth: true }
                },
                {
                    path: '/moment',
                    name: 'moment',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/Moment.vue'),
                    meta: { title: '动态列表', requireAuth: true }
                },
                {
                    path: '/joblogs',
                    name: 'joblogs',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/log/Joblogs.vue'),
                    meta: { title: '任务日志', requireAuth: true }
                },
                {
                    path: '/loginlogs',
                    name: 'loginlogs',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/log/Loginlogs.vue'),
=======
                    path: '/modifyi',
                    name: 'modifyi',
                    component: () =>
                        import ( /* webpackChunkName: "blogtag" */ '../components/page/modifyI.vue'),
                    meta: { title: '获取面试记录', requireAuth: true }
                },
                {
                    path: '/searchc',
                    name: 'searchc',
                    component: () =>
                        import ( /* webpackChunkName: "category" */ '../components/page/searchC.vue'),
                    meta: { title: '查找个人信息面试记录', requireAuth: true }
                },
                {
                    path: '/searchpoweri',
                    name: 'searchpoweri',
                    component: () =>
                        import ( /* webpackChunkName: "category" */ '../components/page/searchPowerI.vue'),
                    meta: { title: '查找面试内容', requireAuth: true }
                },
                {
                    path: '/searchonei',
                    name: 'serarchonei',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/searchOneI.vue'),
                    meta: { title: '动态列表', requireAuth: true }
                },
                {
                    path: '/addi',
                    name: 'addi',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/addI.vue'),
                    meta: { title: '任务日志', requireAuth: true }
                },
                {
                    path: '/deletei',
                    name: 'deletei',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/deleteI.vue'),
>>>>>>> a6928a3 (+)
                    meta: { title: '登录日志', requireAuth: true }
                },
                {
                    path: '/operationlogs',
                    name: 'operationlogs',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/log/Operationlogs.vue'),
                    meta: { title: '操作日志', requireAuth: true }
                },
                {
                    path: '/errorlogs',
                    name: 'errorlogs',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/log/Errorlogs.vue'),
                    meta: { title: '异常日志', requireAuth: true }
                },
                {
                    path: '/vistorlogs',
                    name: 'vistorlogs',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/log/Vistorlogs.vue'),
                    meta: { title: '访问日志', requireAuth: true }
                },
                {
                    path: '/SiteSetting',
                    name: 'SiteSetting',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/SiteSetting.vue'),
                    meta: { title: '站点设置', requireAuth: true }
                },
                {
                    path: '/ImageBed',
                    name: 'ImageBed',
                    component: () =>
                        import ( /* webpackChunkName: "articles" */ '../components/page/ImageBed.vue'),
                    meta: { title: '码云图床', requireAuth: true }
                },
                {
                    path: '/404',
                    name: '404',
                    component: () =>
                        import ( /* webpackChunkName: "404" */ '../components/page/404.vue'),
                    meta: { title: '404', requireAuth: true }
                }
            ]
        },
        {
            path: '/login',
            component: () =>
                import ( /* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
//路由导航守卫
router.beforeEach((to,  from,  next)  =>  {     //console.log("没有token")
        
    if (to.path  ===  '/login')  return  next();    
    const  istoken  =  sessionStorage.getItem('token');     //console.log(istoken)
    console.log(istoken);
    if (!istoken)  return  next('/login');    
    else next();
})

export  default  router